#pragma once

#include "mccommonapi.h"
#include "accesscount.h"

#include <xercesc/dom/DOM.hpp>
#include <string>

namespace MCCommon
{

class MCAPI XMLTextIterator
{
public:
    /**
     * Constructor.
     * 
     */
    XMLTextIterator
    (
        xercesc::DOMNodeIterator* iter,
        xercesc::DOMNodeFilter* filter = 0
    );

    /**
     * Destructor.
     * 
     */        
    virtual ~XMLTextIterator();

    /**
     * Copy constructor.
     * 
     */
    XMLTextIterator
    (
        const XMLTextIterator& eleIter
    );

    /**
     * Assign operator.
     * 
     */
    XMLTextIterator& operator = 
    (
        const XMLTextIterator& eleIter
    );

    /**
     * Is having more text.
     * 
     */
    bool HasMore();

    /**
     * Get next string.
     * 
     */
    std::string Next();

private:
    /**
     * Release all resource.
     * 
     */
    void release();

private:
    // Node iterator.
    xercesc::DOMNodeIterator* fIter; 
    
    // Current node.
    xercesc::DOMNode* fCurNode;

    // Node filter.
    xercesc::DOMNodeFilter* fFilter;
    
    // Access count
    AccessCount fAccCount;
};

} // end of namespace MCXML_NAMESPACE.
